<style>
    #div1 {
        position: relative;
        height: 300px;
        width: 90%;
        background-color: skyblue;
    }
    
    #div2 {
        position: absolute;
        bottom: 0;
        height: 30px;
        width: 100%;
        background-color: lightgreen;
    }
</style>

<div id="div1">
    <div id="div2"> 无论蓝色div高度如何变化，绿色div都会贴在下面
    </div>
</div>